package edu.sandau.b230151.b23015101.service;

import edu.sandau.b230151.b23015101.mapper.BookMapper;
import edu.sandau.b230151.b23015101.model.Book;
import edu.sandau.b230151.b23015101.respository.BookRespository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class BookService {
    @Autowired
    private BookMapper BookMapper;
    @Autowired
    private BookRespository BookRespository;

    public List<Book> findAll(Book book) {
        return BookMapper.findALL(book);
//        return BookRespository.findAll(Example.of(book));
    }
     public void deleteById(String id) {
         BookMapper.deleteById(id);
    }
    public void save(Book s){
        BookMapper.save(s);
    }
    public Book getReferenceById(String id) {
        return BookMapper.getReferenceById(id);
    }
    public void update(Book s){
        BookMapper.update(s);
    }
}
